﻿<?php
/* 	Design Theme's Featured Box to show the Featured Items of Front Page
	Copyright: 2012, D5 Creation, www.d5creation.com
	Based on the Simplest D5 Framework for WordPress
	Since Design 1.0
*/
?>

<div class="featured-boxs">

<?php
for ($i = 1; $i <= 3; $i++)
{
?>
<span class="featured-box">
	<a href="<?php echo of_get_option('featured-link'.$i, '#'); ?>">
		<span class="frame-box">
			<img src="<?php echo of_get_option('featured-image'.$i, get_template_directory_uri() . '/images/featured-image'.$i.'.jpg') ?>"/>
		</span>
	</a>
	<div class="caption-container">
		<a href="portfolio-single.html"><span class="bold"><?php echo of_get_option('featured-title'.$i); ?></span></a>
	</div>
	<div class="text-container">
		<p><?php echo of_get_option('featured-desc'.$i); ?></p>
	</div>
</span>
<?php }?>


</div> <!-- featured-boxs -->

<div class="sep3">sep</div>
<!-- Ứng dụng nổi bật -->
<span class="featured-content1">
	<h2><?php echo of_get_option('fcontent01-title1', 'Design a Smart Theme by '); ?><span> <?php echo of_get_option('fcontent02-title1', 'D5 Creation'); ?></span></h2>
	<?php global $post;
	$query = array('numberposts' => 4, 'post_type' => 'product','meta_query' => array(
			array(
					'key' => 'special_product',
					'value' => 'on',
			)
	));
	$special_products = get_posts( $query );
	
	foreach ($special_products as $product)
	{
		$name = get_post_meta($product->ID, 'product_name', TRUE);
		$thumb_img = get_post_meta($product->ID, 'product_image', TRUE);
		$large_image = wp_get_attachment_url( get_post_thumbnail_id($product->ID) );
		$desc_short = get_post_meta($product->ID, 'product_description', TRUE);
		$desc_long = $product->post_content; //content product
		$title_product = $product->post_title; //title lớn ở trên
		$link = $product->guid;//link di toi trang detail của product
	?>
		<div class="product-frame">
			<a href="<?php the_permalink(); ?>">
				<div class="product-content">
					<div class="product-desc">
						<img alt="<?php echo $product->post_title; ?>" src="<?php echo $large_image?>" />
						<div class="product-name"><?php echo $name; ?></div>
							
					</div>
					<div class="product-hover">					
						<img alt="<?php echo $product->post_title; ?>" src="<?php echo $thumb_img?>"/>
						<div class="product-name"><?php echo $name; ?></div>
						<div class="product-short-description">
						<?php echo $desc_short ;?>
						</div>
						<div class="product-platform">
							<span class="platform-ios"></span>
							<span class="platform-ios"></span>
							<span class="platform-ios"></span>
						</div>			
					</div>
					
				</div>
			</a>
		</div>
		<?php } ?>
</span>

<!--Tin Tức Nổi Bật-->
<span class="featured-content2">
<h2><?php echo of_get_option('fcontent01-title2', 'Design a Smart Theme by '); ?><span> <?php echo of_get_option('fcontent02-title2', 'D5 Creation'); ?></span></h2>
<ul>
	<?php
	global $post;
	$query = 
	array('numberposts' => 5, 'post_type' => 'post');
	$special_products = get_posts( $query );
	foreach ($special_products as $product)
	{
	?>
		<li><a href="<?php the_permalink() ?>"><?php echo $product->post_title ?></a></li>
	<?php
	}?>
</ul>
</span>

<div class="sep2">sep</div>